﻿/// <reference path="RequestHandler.js" />
/// <reference path="../HttpRequest.js" />
/// <reference path="../../utilities/Markup.js" />
/// <reference path="../../utilities/Xpcom.js" />
///--------------------------------------------------------------------
/// <file name="ForumSettingsHandler.js">
///   Adds markup buttons to the edit signature page.
/// </file>
///--------------------------------------------------------------------

NAMFox.ns(function() { with (NAMFox) {

this.ForumSettingsHandler = function() {
};

ForumSettingsHandler.prototype = new RequestHandler();
ForumSettingsHandler.prototype.name = "ForumSettingsHandler";

ForumSettingsHandler.prototype.handleRequestCore = function(request, _$) {
    /// <summary>Handles a request.</summary>
    /// <param name="request" type="HttpRequest">
    ///   The HTTP request which encapsulates the
    ///   document and route data for this request.
    /// </param>

    var textArea = _$("textarea[name=forum_sig]");
    
    if (textArea.length > 0) {
        request.htmlDocument.__namfox__.textArea = textArea;
        
        textArea.before(
            Markup.create(
                textArea,
                MarkupLocation.EditSignature,
                Markup.bold,
                Markup.italics,
                Markup.underline,
                Markup.quote,
                Markup.linkName,
                Markup.superscript,
                Markup.subscript
            )
        );
    }
};

}});